﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace PACKETPARSERMAX20.CONSOLE
{
    public static class Common
    {
        private static float previous = 0f;

        public static void WritePercent(long index, long total)
        {
            float current = (float)Math.Round(((((double)index + 1) / total) * 100));
            var CursorTop = Console.CursorTop;
            var CursorLeft = Console.CursorLeft;

            if (previous != current) { previous = current; Console.Write(current.ToString() + "%"); }

            Console.SetCursorPosition(CursorLeft, CursorTop);
 
        }
    }
}
